import {get,post,put,del} from '@/utils/request/axios';

/**
 * 登录接口
 * @param obj 登录信息
 * @returns {*}
 */
export const login = (obj) => {
  const url = "/login";
  return post(url,obj);
}

/**
 * 获取验证码
 * @param obj
 * @returns {*}
 */
export const verificationCode = (obj) => {
  const url = "/api/sys/getVerificationCode";
  return get(url,obj);
}

/**
 * 退出登录接口
 * @returns {*}
 */
export const loginOut = () => {
  const url = "/logout";
  return post(url);
}

/**
 * 分页查询
 * @param obj
 * @returns {*}
 */
export const listPageUserInfo = (obj) =>{
  const url = "/leader/sysUser/page";
  return get(url,obj);
}

/**
 * 添加用户
 * @param obj
 * @returns {*}
 */
export const addUser = (obj) =>{
  const url = "/leader/sysUser";
  return post(url,obj);
}

/**
 * 修改用户信息
 * @param obj
 * @returns {*}
 */
export const updateUser = (id,obj) =>{
  const url = "/leader/sysUser/"+id;
  return put(url,obj);
}

/**
 * 修改用户状态
 * @param obj
 * @returns {*}
 */
export const deleteUser = (id) =>{
  const url = "/leader/sysUser/"+id;
  return del(url);
}

/**
 * 用户授权角色
 * @param obj
 * @returns {*}
 */
export const allotRoleForUser = (id,obj) =>{
  const url = "/leader/sysUserRole/allotRoleForUser/"+id;
  return post(url,obj);
}

export const getCurrentBasicUserInfo = (obj) =>{
  const url = "/leader/sysUser/getCurrentUserInfo";
  return get(url,obj);
}

/**
 * 修改密码
 * @param obj
 * @returns {*}
 */
export const updatePassword = (obj) =>{
  const url = "/api/sys/user/updatePassword";
  return post(url,obj);
}
